package sentinel.resttemplate.demo01.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping
public class SentinelRestTemplateController {
  
  @Autowired
  private RestTemplate restTemplate;
  
  @GetMapping("/getInfo/{id}")
  public String getInfo(@PathVariable("id") String id) {
    String forObject = restTemplate.getForObject("http://base-common-nacos/getInfo/" + id, String.class);
    return forObject;
  }
}
